package com.senseuni.da.utils

object SpUtil {

    private const val KEY_IMAGE_DURATION = "image_duration"

    fun getImageDuration(): Long {
        return MmkvUtil.getInstance().getLong(KEY_IMAGE_DURATION, 30)
    }

    fun setImageDuration(duration: Long) {
        MmkvUtil.getInstance().put(KEY_IMAGE_DURATION, duration)
    }

    fun saveQRCode(code: String) {
        MmkvUtil.getInstance().put("qrcode_content", code)
    }

    fun getQRCode(): String {
        return MmkvUtil.getInstance().getString("qrcode_content", "")
    }

    fun getMediaKey() : String {
        return MmkvUtil.getInstance().getString("media_key", "")
    }

    fun saveMediaKey(key: String) {
        MmkvUtil.getInstance().put("media_key", key)
    }

    fun isSleepEnabled() : Boolean {
        return MmkvUtil.getInstance().getBoolean("sleep_enabled", true)
    }

    fun saveSleepEnabled(enabled: Boolean) {
        MmkvUtil.getInstance().put("sleep_enabled", enabled)
    }

    fun getSleepTime(): String {
        return MmkvUtil.getInstance().getString("sleep_time", "23:00")
    }

    fun saveSleepTime(time: String) {
        MmkvUtil.getInstance().put("sleep_time", time)
    }

    fun getActiveTime(): String {
        return  MmkvUtil.getInstance().getString("active_time", "7:00")
    }

    fun saveActiveTime(time: String) {
        MmkvUtil.getInstance().put("active_time", time)
    }

    fun getLanguage(): String {
        return MmkvUtil.getInstance().getString("language", "")
    }

    fun saveLanguage(language: String) {
        MmkvUtil.getInstance().put("language", language)
    }

    fun isShowNotification(): Boolean {
        return MmkvUtil.getInstance().getBoolean("show_notification", true)
    }

    fun saveShowNotification(enabled: Boolean) {
        MmkvUtil.getInstance().put("show_notification", enabled)
    }

    fun isShowNotificationNewImage(): Boolean {
        return MmkvUtil.getInstance().getBoolean("show_notification_new_image", true)
    }

    fun saveShowNotificationNewImage(enabled: Boolean) {
        MmkvUtil.getInstance().put("show_notification_new_image", enabled)
    }

    fun isShowNotificationNewFriend(): Boolean {
        return MmkvUtil.getInstance().getBoolean("show_notification_new_friend", true)
    }

    fun saveShowNotificationNewFriend(enabled: Boolean) {
        MmkvUtil.getInstance().put("show_notification_new_friend", enabled)
    }

    fun isShowNotificationUpgrade(): Boolean {
        return MmkvUtil.getInstance().getBoolean("show_notification_upgrade", true)
    }

    fun saveShowNotificationUpgrade(enabled: Boolean) {
        MmkvUtil.getInstance().put("show_notification_upgrade", enabled)
    }
}